import {observable} from 'mobx';
import {request} from '../../utils/request';
import Loading from '../../components/widget/Loading';

class HomeStore {
  @observable detail: Article = {} as Article;
  requestArticleDetail = async (id: number) => {
    Loading.show();
    try {
      const params = {
        id,
      };

      const {data} = await request('articleDetail', params);
      this.detail = data || {};
      console.log(this.detail);
    } catch (error) {
      console.log(error);
    } finally {
      Loading.hide();
    }
  };
}

export default new HomeStore();
